/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cda.memo;

import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.zxing.WriterException;
import java.io.FileNotFoundException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Shyzkanza
 */
public class AfficheCode extends Activity {
    
    ImageView                           _codeImage;
    TextView                            _codeTexte;

    /**
     * Called when the activity is first created.
     */
    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.codeaffiche);
        
        QRCodeGenerator QRCG = new QRCodeGenerator();
        super.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        try {
            QRCG.generateCode(Main.TYPE, Main.DONNEES);
            // ToDo add your GUI initialization code here
        } catch (WriterException ex) {
            Logger.getLogger(AfficheCode.class.getName()).log(Level.SEVERE, null, ex);
        } catch (FileNotFoundException ex) {
            Logger.getLogger(AfficheCode.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        _codeImage = (ImageView)findViewById(R.id.codeimg);
        _codeTexte = (TextView)findViewById(R.id.codetxt);
        
        Bitmap img = BitmapFactory.decodeFile("/sdcard/cda.memo/out.png");
        
        _codeImage.setImageBitmap(img);
        _codeTexte.setText(Main.DONNEES);
    }
}
